#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    ui->dial->setMaximum(100);
    ui->dial->setWrapping(true);//允许转圈
    ui->dial->setNotchesVisible(true);//线条可视度
    ui->dial->setMinimum(0);
    ui->dial->setValue(100);
    ui->dial->setSliderPosition(50);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_dial_valueChanged(int value)
{
    ui->label->setText(QString("当前不透明度为: ") + QString::number(value));
    this->setWindowOpacity((float)value/100);//opacity的值为0.0~1.0
}

